#include "stdio.h"
#include "stdlib.h"
#include "string.h"

int countDistinctWord(char s[]) {
    // todo add your algorithm here
	char str[100][100];
	int num,i,start,end,j,n;
	for(i=0,num=0;s[i]!='\0';i++){
		if(s[i]==' ')num++;
	}
	num=num+1;
	start=0;
	end=0;

	for(i=0,j=0;s[j]!='\0';j++){
		if(s[j] == ' '){
			end=j;
			for(n=0;n<end-start;n++){
				str[i][n] = s[n+start];
				
			}
			str[i][n]='\0';
			start = end;
			i++;
		}
	}
	end = strlen(s);
	for(n=0;n<end-start;n++){
		str[i][n] = s[n+start];
	}
	str[i][n]='\0';

	for(i=0,n=num;i<num;i++){
		for(j=i+1;j<num;j++){
			if(strcmp(str[i],str[j])==0) n--;
		}
	}
	return n;
}


int main(void) {
	char s[] = "a b c def asg da fe d c b";
	printf("%d", countDistinctWord(s));
	return 0;
}